#ifndef __MOTOR_H__
#define __MOTOR_H__

#include "gpio/_gpio.h"
#include "ti_msp_dl_config.h"

#define MOTOR_TIMER_MAX_COUNT 1000

typedef struct
{
    gpio_t* dir1;
    gpio_t* dir2;
    GPTIMER_Regs* timer_inst;
    DL_TIMER_CC_INDEX cc_index;
    volatile uint32_t speed;
} motor_t;

void motor_start(motor_t* motor);
void motor_stop(motor_t* motor);
void motor_set_speed(motor_t* motor, float duty);

#endif
